/**
 * Copyright (c) 2009 blurredVision
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
 * associated documentation files (the "Software"), to deal in the Software without restriction, 
 * including without limitation the rights to use, copy, modify, merge, publish, distribute, 
 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is 
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all copies or 
 * substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 
 * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 
 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT 
 * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */
#ifndef __WINDOW_H__
#define __WINDOW_H__

#pragma once

#include "common/Singleton.h"

/**
 * \ingroup CoreEngine
 *
 * Creates a window for use in the application.<br>
 * This can be either fullscreen or windowed.
 * 
 * \date 03-28-2007
 *
 * \author juckel
 *
 */
class DLL_EXPORT Window
//	: public Singleton<Window>
{
public:
	//Window(void);

	Window( LPSTR className, WNDPROC wProc);
	virtual ~Window(void);

	/// Creates a new window
	//bool createWindow( int width, int height, int colorDepth, bool fullscreen, bool vsync = false, std::string winName);
	bool createWindow( int width, int height, int colorDepth, bool fullscreen, bool vsync);//, std::string winName);

	/// Destroys the current window
	void destroyWindow();

	/// Returns the window handle
	HWND getHWnd() const { return hWnd; }

	/// Returns the instance of the application
	HINSTANCE getHInstance() const { return hInst; }

	/// Returns the width of the window
	const int getWidth() const { return iWidth; };

	/// Returns the height of the window
	const int getHeight() const { return iHeight; };

	/// Indicates if the window is in fullscreen mode
	const bool isFullscreen() const;

	/// Indicates if the window has VSync enabled
	const bool hasVSync() const;

	/// Returns the color depth of the window
	const int getColorDepth() const { return iColorDepth; }

	/// Indicates if a window is currently minimized
	const bool isMinimized() const;

	/// Indicates if a window is currently active
	const bool isActive() const;

	/// Minimizes/Maximizes the window
	void setMinimized(bool value);

	/// Enables/Disables the window
	void setActive(bool value);

	/// Returns the name of the window
	const LPSTR getName();

protected:
	WNDCLASSEX createWinClass( LPSTR className );

private:
	int iWidth;
	int iHeight;
	int iColorDepth;
	bool bFullscreen;
	bool bMinimized;
	bool bActive;
	bool bVSync;
	HINSTANCE hInst;
	HWND hWnd;
	LPSTR className;
	WNDPROC wndProc;
};

/**
 *  Returns the window handle for querying window states
 *  @returns	The window class of the core 
 */
DLL_EXPORT
Window* coreGetMainWindow();


#endif
